package cn.ywsj.ywsjmidtier.controller;

import cn.ywsj.ywsjmidtier.entity.OrderReturnDetailQuery;
import cn.ywsj.ywsjmidtier.entity.VO.ThOrderListQueryVo;
import cn.ywsj.ywsjmidtier.service.WechatOrderReturnFeign;
import cn.ywsj.ywsjmidtier.utils.JsonObjectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.bind.BindResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "订单退货")
@RestController
@RequestMapping("/wechat/member/orderreturn")
public class WechatOrderReturnController {
    @Autowired
    private WechatOrderReturnFeign wechatOrderReturnFeign;

    /**
     * 协商历史
     * @param orderQuery
     * @param result
     * @return
     */
    @ApiOperation("协商历史")
    @RequestMapping("/getreturnmessage")
    public String getreturnmessage(OrderReturnDetailQuery orderQuery, BindResult result){
        return wechatOrderReturnFeign.getReturnMessage(JsonObjectUtil.ObjectToJson(orderQuery),result);
    }

    /**
     * 退货详情
     * @param queryVo
     * @return
     */
    @ApiOperation("退货详情")
    @PostMapping("/ajaxorderdetail")
    public String ajaxOrderdetail(ThOrderListQueryVo queryVo){
        return wechatOrderReturnFeign.ajaxOrderdetail(JsonObjectUtil.ObjectToJson(queryVo));
    }

    /**
     * 退货单列表
     * @param start
     * @param pageSize
     * @return
     */
    @ApiOperation("退货单列表")
    @PostMapping("/ajaxorderreturnlist")
    public String myOrderList(Integer start,Integer pageSize){
        return wechatOrderReturnFeign.myOrderList(start,pageSize);
    }

}
